package com.taotao.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.EasyUITree;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.content.service.ContentCategoryService;


@Controller
@RequestMapping("/content/category")
public class ContentCategoryController {

	@Autowired
	private ContentCategoryService categoryService ;
	
	@RequestMapping("/list")
	@ResponseBody
	public List<EasyUITree> getContentCatList(
			@RequestParam(value="id",defaultValue="0")long parentId){
		
		List<EasyUITree> list = categoryService.getContentCategoryList(parentId);
				return list;
	}
	
	@RequestMapping("/create")
	public TaotaoResult createContentCategory(long parentId,String name){
		TaotaoResult result = categoryService.createCategory(parentId, name);
		
		return result;
	}
}
